<template>
  <div class="home">
    <div class="container">
      <div class="content">
        <div class="left">
          <div class="title">聚赋云</div>
          <div class="subtitle">人力资源用工服务平台</div>
          <div class="slogan">基于SaaS的人力资源用工生态智能解决方案<br>标准化、个性化、专业化一站式代缴服务</div>
        </div>
        <div class="right">
          <div class="tab">
            <div class="button">{{activeName === 'register' ? '注册' : '找回密码'}}</div>
          </div>
          <div class="content">
            <login-component v-if="activeName === 'login'" @active="handleActive"></login-component>
            <register-component v-if="activeName === 'register'" @active="handleActive"></register-component>
            <resetpwd-component v-if="activeName === 'resetpwd'" @active="handleActive"></resetpwd-component>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import LoginComponent from './components/login'
import RegisterComponent from './components/register'
import ResetpwdComponent from './components/resetpwd'
import { mapGetters } from 'vuex'
export default {
  name: "login",
  computed:{
    ...mapGetters([
      'userInfo'
    ]),
  },
  components: {
    LoginComponent,
    RegisterComponent,
    ResetpwdComponent
  },
  data() {
    return {
      activeName: 'login'
    };
  },

  methods:{
    handleActive(name) {
      if (name === 'login') {
        this.$router.replace('/home')
        return
      }
      this.$router.replace(`/${this.$route.params.role}/auth/${name}`)
    },
    handleRoute() {
      this.activeName = this.$route.params.type || 'login'
    }
  },
  watch: {
    '$route': 'handleRoute'
  },
  created() {
    this.activeName = this.$route.params.type || 'login'
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.home {
  height: 100vh;
  overflow: hidden;
}
.container {
  width: 100%;
  height: calc(100vh);
  background: url('/images/banner.png') no-repeat center center;
  background-size: cover;
  color: #fff;
  .content {
    width: 1500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
  }
  .left {
    height: 660px;
    .title {
      font-size: 30px;
      color: #00e0ff;
    }
    .subtitle {
      font-size: 30px;
      color: #fff;
      margin-top: 10px;
    }
    .slogan {
      margin-top: 60px;
      position: relative;
      padding-top: 30px;
      line-height: 40px;
      font-size: 20px;
      color: #5f5f5f;
      &::after {
        content: "";
        width: 145px;
        height: 4px;
        position: absolute;
        background-color: #5f5f5f;
        left: 0;
        top: 0;
      }
    }
  }
  .right {
    width: 400px;
    // margin-right: 55px;
    border: 1px solid #2d2c32;
    box-sizing: border-box;
    padding: 35px 30px 40px;
    background: rgba(19, 18, 24, .9);
    .tab {
      display: flex;
      height: 30px;
      font-size: 20px;
      .button {
        flex: 1;
        text-align: center;
        color: #5d5d5d;
        cursor: pointer;
        transition: all .2s ease;
        &.active {
          color: #c7c7c7;
        }
      }
    }
    .content {
      width: 100%;
      margin-top: 30px;
      /deep/ .el-input__inner {
        color: #fff;
        background-color: #1b1a20;
        border-color: transparent;
      }
    }
  }
}

@media only screen and (max-width: 1500px) {
  .home {
    min-width: 1200px;
  }
  .page-header {
    .header-content {
      width: 1200px;
    }
  }
  .container {
    .content {
      width: 1200px;
    }
  }
}
</style>
